Ext.define("AM.controller.Users",{
	extend : "Ext.app.Controller",

	views : [
		"user.List",
		"user.Edit"
	],

	stores : [
		"Users"
	],

	models : [
		"User"
	],

	init : function() {
		console.log("Initialized Users!");
		this.control({
			"viewport > panel" : {
				render: this.onPanelRendered
			},
			"userList" : {
				itemdblclick : this.editUser
			}
		});
	},

	onPanelRendered : function() {
		console.log("The panel is rendered");
	},

	editUser : function(grid,record) {
		console.log("Double clicked on " + record.get("name"));

		var view = Ext.widget("useredit");
		view.down("form").loadRecord(record);
	}
});